package com.xia.util.common;

import java.util.HashMap;

public class Result extends HashMap<String,Object> {

    public Result(String code,String msg,Object data) {
        super.put("code",code);
        super.put("msg",msg);
        super.put("data",data);
    }

    public static Result success(Object data) {
        return Result.success("返回成功",data);
    }

    public static Result success(String msg){
        return new Result("200",msg,null);
    }

    public static Result success(String msg,Object data){
        return new Result("200",msg,data);
    }

    public static Result success(){
        return Result.success("返回成功",null);
    }

    public static Result error(String msg){
        return new Result("400",msg,null);
    }
    public static Result error(String code,String msg){
        return new Result(code,msg,null);
    }
}
